Skip to content

selectors: coordinate name attributes and nested sibling previews - #577

Merged
Martin Aeschlimann (aeschli) merged 5 commits into
mainfrom
aeschli/combine-selector-hover-fixes
Nov 24, 2026
Merged

Martin Aeschlimann (aeschli) merged 5 commits into
mainfrom
aeschli/combine-selector-hover-fixes

Conversation

@aeschli

Copy link
Copy Markdown
Collaborator

Summary

Combine #545 by Xnerv Wang (@xnervwang) and #546 by Usman Tahir Qureshi (@UsmanQT) while preserving both original commits and authorship.

  • Preserve [name] attributes in selector hover previews without treating them as element names.
  • Preserve preceding sibling selectors when nested selectors reference their parent with &.
  • Fix their integration mismatch: LabelElement.clone() now reads ELEMENT_NAME, matching the storage introduced by Fix name attributes in CSS selector hovers #545, rather than the old name key. This prevents literal null from replacing the ⋮ and … placeholders.
  • Extend the combined regression coverage to CSS, LESS, and SCSS, including selectors with both [name] attributes and sibling combinators, and cloned descendant placeholders.

History and merging

Both original PR heads are ancestors of this branch, unchanged:

The two new integration merge commits are cryptographically signed. Please merge this PR using a merge commit, not squash or rebase, to preserve contributor commits and authorship. This is a combined integration PR, not an exact-head mirror. Neither original PR was modified or closed.

Validation

  • Reproduced the two failing CSS/SCSS selector tests with the original PRs combined.
  • npm run compile: passed, including all 7 lint checks.
  • Focused selector suites: 41 passed.
  • Full suite with explicit Windows-compatible test-file enumeration: 421 passed, 0 failed, 0 skipped.
  • Verified both new commit signatures locally and original-head ancestry.

Related: #545, #546.

… with `&`

When a parent selector contains `+` or `~` and a nested rule references
it with `&` (e.g. `.foo + .bar { .baz & {} }`), the hover preview left
`.foo` at the top level and only moved `.bar` under `.baz`.

- processSelector now moves the whole parent context out of the root
- cloneWithParent also clones preceding siblings on the path
- clone keeps LabelElement so `⋮` still prints as a label

Fixes microsoft/vscode#169900

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Preserve the original contribution for coordinated selector-hover integration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve the original commits from #546 alongside #545. Clone label names through ELEMENT_NAME so nested sibling previews retain their placeholders and name attributes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@aeschli
Martin Aeschlimann (aeschli) merged commit f272767 into main Nov 24, 2026
5 checks passed
@aeschli
Martin Aeschlimann (aeschli) deleted the aeschli/combine-selector-hover-fixes branch November 24, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants